<?php

namespace app\common\model;

use app\common\model\BaseModel as BaseModel;
use app\common\traits\TimeCacheTrait;

/**
 * Class Landing
 * @package app\common\model
 * @property int $id
 * @property string $landingType
 * @property int $memberId
 * @property int $questionId
 * @property string $ask
 * @property int $categoryId
 * @property int $moneyId
 * @property int $provinceId
 * @property int $cityId
 * @property string $phone
 * @property string $details
 * @property int $detailsValid
 * @property int $consultingServerId
 * @property int $consultingServerSkuId
 * @property string $pf
 * @property string $chain
 * @property int $promotionGroupId
 * @property string $pagePath
 * @property int $status
 * @property int $step
 * @property int $aryMatch
 * @property int $updated
 * @property int $created
 * @property Chain fromChain
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037579
 * @link https://www.kancloud.cn/manual/think-orm/1257998
 * @link https://www.kancloud.cn/thinkphp/master-database-and-model/265551
 */
class Landing extends BaseModel implements ARYPushInterface
{
    use TimeCacheTrait;

    protected $name = 'Landing';

    // 设置json类型字段
    protected $json = ['details'];
    protected $jsonAssoc = true;

    public function fromChain()
    {
        return $this->hasOne(Chain::class, 'chain', 'chain');
    }

    // 用户
    public function member()
    {
        return $this->belongsTo(Member::class, 'memberId', 'id');
    }

    // 案件类型
    public function category()
    {
        return $this->belongsTo(LawCaseCategory::class, 'categoryId', 'id');
    }

    /**
     * 1对1
     * @return \think\model\relation\HasOne
     */
    //    public function one(){
    //        return $this->hasOne( Test1::class, 'Test1表中的键', 'Landing1表中的键');
    //    }

    /**
     * 1对多
     * @return \think\model\relation\HasMany
     */
    //    public function many(){
    //        return $this->hasMany( Test1::class, 'Test1表中的键', 'Landing1表中的键');
    //    }

    /**
     * 多对多
     * @return \think\model\relation\BelongsToMany
     */
    //    public function belongs(){
    //        return $this->belongsToMany( Test1::class, '中间表', '中间表中Test1的键', '中间表中Landing1的键');
    //    }
}
